# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=postgresql-pg_variables
pkgver=1.2.4_git20220909
_gitrev=9f9466c2b9193133446851b1f4b2b5b192d8f0e0
pkgrel=2
pkgdesc="Session wide variables for PostgreSQL"
url="https://github.com/postgrespro/pg_variables"
arch="all"
license="PostgreSQL"
makedepends="postgresql-dev"
subpackages="$pkgname-bitcode"
source="https://github.com/postgrespro/pg_variables/archive/$_gitrev/$pkgname-$_gitrev.tar.gz"
builddir="$srcdir/pg_variables-$_gitrev"
options="!check"  # tests require running PostgreSQL

build() {
	make USE_PGXS=1
}

package() {
	_pgver=$(pg_config --major-version)
	depends="postgresql$_pgver"

	make USE_PGXS=1 DESTDIR="$pkgdir" install
}

bitcode() {
	_pgver=$(pg_config --major-version)
	pkgdesc="$pkgdesc (bitcode for JIT)"
	depends="$pkgname=$pkgver-r$pkgrel"
	install_if="postgresql$_pgver-jit $pkgname=$pkgver-r$pkgrel"

	amove usr/lib/postgresql*/bitcode
}

sha512sums="
277d76665e0be5dffd99cee8290ccf2be72246e7756ae456674633bbbd2ebfe79bf3d5f0a67b69dede460cdfb3fb43c000b6ca472ef5176138877628070e7539  postgresql-pg_variables-9f9466c2b9193133446851b1f4b2b5b192d8f0e0.tar.gz
"
